package com.woniuxy.service.impl;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.woniuxy.api.RemoteProductServe;
import com.woniuxy.entity.ProductDTO;
import com.woniuxy.entity.utils.ResponseEntity;
import com.woniuxy.service.OrderServiceByProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceByProductImpl implements OrderServiceByProduct {

    @Autowired
    RemoteProductServe remoteProductServe;

    @Override
//    @HystrixCommand
    public ResponseEntity findProductList(String name, double minPrice, double maxPrice) {
//        return remoteProductServe.findAllByNameOrPrice(name,minPrice,maxPrice);
//        Map map = new HashMap<>();
//        map.put("name",name);
//        map.put("minPrice",minPrice);
//        map.put("maxPrice",maxPrice);
        return remoteProductServe.findAllByNameOrPrice(new ProductDTO(name,minPrice,maxPrice));
    }
}
